#ifndef _ROS_learning_test_sensor_h
#define _ROS_learning_test_sensor_h

#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"

namespace learning_test
{

  class sensor : public ros::Msg
  {
    public:
      typedef bool _forward_type;
      _forward_type forward;
      typedef uint16_t _speed_type;
      _speed_type speed;

    sensor():
      forward(0),
      speed(0)
    {
    }

    virtual int serialize(unsigned char *outbuffer) const override
    {
      int offset = 0;
      union {
        bool real;
        uint8_t base;
      } u_forward;
      u_forward.real = this->forward;
      *(outbuffer + offset + 0) = (u_forward.base >> (8 * 0)) & 0xFF;
      offset += sizeof(this->forward);
      *(outbuffer + offset + 0) = (this->speed >> (8 * 0)) & 0xFF;
      *(outbuffer + offset + 1) = (this->speed >> (8 * 1)) & 0xFF;
      offset += sizeof(this->speed);
      return offset;
    }

    virtual int deserialize(unsigned char *inbuffer) override
    {
      int offset = 0;
      union {
        bool real;
        uint8_t base;
      } u_forward;
      u_forward.base = 0;
      u_forward.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
      this->forward = u_forward.real;
      offset += sizeof(this->forward);
      this->speed =  ((uint16_t) (*(inbuffer + offset)));
      this->speed |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
      offset += sizeof(this->speed);
     return offset;
    }

    virtual const char * getType() override { return "learning_test/sensor"; };
    virtual const char * getMD5() override { return "77bc0fb12be8959653ed3ec0fd2d9538"; };

  };

}
#endif
